#ifndef DATABASETOOL_H
#define DATABASETOOL_H
#include <QObject>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlDriver>
#include <QSqlQuery>
class databaseTool:public QObject
{
    Q_OBJECT
public:
    databaseTool();
    databaseTool(QString ip,int port,QString dataBaseName ,QString userName,QString passWord,QObject *parent);
    bool initializeDataBase(QString ip,int port,QString dataBaseName ,QString userName,QString passWord);
    const QSqlDatabase *getDb() const;
    void setDb(const QSqlDatabase &newDb);

    bool getIsDBok() const;
    void setIsDBok(bool newIsDBok);
    QString findPSWforACC(QString acc);

    QMap<QString,QString> getUserDetailInformation(QString acc);

private:
    QString ip;
    int port;
    QString dataBaseName;
    QString userName;
    QString passWord;
    QSqlDatabase db;
    bool isDBok=false;
};

#endif // DATABASETOOL_H
